package com.fbty.mt.intercept;

import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.fbty.mt.domain.User;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class SessionInterceptor extends AbstractInterceptor {
	
	public String intercept(ActionInvocation ai) throws Exception {
		Map<String, Object> session = ServletActionContext.getContext().getSession();
		User u = (User)session.get("user");
		if(u==null){
			return "login";
		}
		return ai.invoke();
	}

}
